HTTP Methods

The HTTP method tells the server what action the user wants to perform on the resource identified by the URL path. Here are some of the most common methods and their possible security issue:

GET

Used to fetch data from the server without making any changes. Reminder! Make sure you’re only exposing data the user is allowed to see. Avoid putting sensitive info like tokens or passwords in GET requests since they can show up as plaintext.

Back To Top ▲

POST

Sends data to the server, usually to create or update something. Reminder! Always validate and clean the input to avoid attacks like SQL injection or XSS.

Back To Top ▲

PUT

Replaces or updates something on the server. Reminder! Make sure the user is authorised to make changes before accepting the request.

Back To Top ▲

DELETE

Removes something from the server. Reminder! Just like with PUT, make sure only authorised users can delete resources.

Back To Top ▲


Besides these common methods, there are a few others used in specific cases:

PATCH

Updates part of a resource. It’s useful for making small changes without replacing the whole thing, but always validate the data to avoid inconsistencies.

Back To Top ▲

Works like GET but only retrieves headers, not the full content. It’s handy for checking metadata without downloading the full response.

Back To Top ▲

OPTIONS

Tells you what methods are available for a specific resource, helping clients understand what they can do with the server.

Back To Top ▲

TRACE

Similar to OPTIONS, it shows which methods are allowed, often for debugging. Many servers disable it for security reasons.

Back To Top ▲

CONNECT

Used to create a secure connection, like for HTTPS. It’s not as common but is critical for encrypted communication.

Back To Top ▲


Each of these methods has its own set of security rules. For example, PATCH requests should be validated to avoid inconsistencies, and OPTIONS and TRACE should be turned off if not needed to avoid possible security risks.